import request from '@/api/utils/request';

/**
 * 获取一级考核分类信息
 */
export const getOneExamineItem = () =>
  request({
    method: 'get',
    url: '/schExamineItem/getOneExamineItem/'
  });

/**
 * 获取下级考核分类信息
 * superiorId 指定的上级分类Id
 */
export const getExamineItemTree = data =>
  request({
    method: 'get',
    url: '/schExamineItem/getExamineItemTree',
    params: data
  });
/**
 * 添加一级考核分类信息
 */
export const createOneExamineItem = data =>
  request({
    method: 'POST',
    url: '/schExamineItem/createOneExamineItem',
    data
  });

/**
 * 添加子级考核分类信息
 */
export const createNextExamineItem = data =>
  request({
    method: 'POST',
    url: '/schExamineItem/createNextExamineItem',
    data
  });

/**
 * 修改分类信息
 */
export const updateExamineItem = data =>
  request({
    method: 'post',
    url: '/schExamineItem/updateExamineItem',
    data
  });

/**
 * 删除分类信息
 * @param {id :  123}
 */
export const removeExamineItem = data =>
  request({
    method: 'delete',
    url: '/schExamineItem/removeExamineItem/',
    params: data
  });

/**
 * 获取分类信息
 */
export const getAllSortExamineItem = () =>
  request({
    method: 'get',
    url: '/schExamineItem/getAllSortExamineItem/'
  });
/**
 * 搜索考核分类信息
 */
export const getExamineItem = data =>
  request({
    method: 'get',
    url: '/schExamineItem/getExamineItem',
    params: data
  });

/**
 * 获取考核相关设置
 */
export const getExamineSetting = () =>
  request({
    method: 'get',
    url: '/schExamineSetting/getExamineSetting'
  });
/**
 * 获取考核等级详情(其他信息的保存)
 * @param {isFastMark : true/false}
 *  true获取系统快速打分下的所有等级
 *  false获取系统打分模式下的所有等级
 */
export const getExamineGradeDetail = data =>
  request({
    method: 'get',
    url: '/schExamineSetting/getExamineGradeDetail',
    params: data
  });

/**
 * 设置打分模式(打分模式信息保存)
 */
export const setMarkModel = data =>
  request({
    method: 'post',
    url: '/schExamineSetting/setMarkModel',
    data
  });
/**
 * 设置快速打分(快速打分信息保存)
 */
export const setFastMark = data =>
  request({
    method: 'post',
    url: '/schExamineSetting/setFastMark',
    data
  });
/**
 * 设置个人项目扣分汇总方式(其他信息的保存)
 * @param {summaryMethod : 0/1} 汇总方式 0 个人扣分汇总,1 按项扣分汇总
 */
export const summarySetting = data =>
  request({
    method: 'get',
    url: '/schExamineSetting/summarySetting',
    params: data
  });
/**
 * 关闭快速打分
 */
export const closeFastMark = () =>
  request({
    method: 'get',
    url: '/schExamineSetting/closeFastMark/'
  });

/**
 * 获取项目的详细信息
 */
export const getIdExamineItem = id =>
  request({
    method: 'get',
    url: '/schExamineItem/getExamineItem/' + id
  });
// 下边是亮灯规则
/**
 * 保存亮灯配置
 */
export const saveLightSettingAndType = data =>
  request({
    method: 'post',
    url: '/schExamineLightSetting/saveLightSettingAndType',
    data
  });
/**
 * 查询当前租户亮灯时间设置
 */
export const getLightSetting = () =>
  request({
    method: 'get',
    url: '/schExamineLightSetting/getLightSetting'
  });

/**
 * 查询当前租户所有亮灯规则
 */
export const listLightType = () =>
  request({
    method: 'get',
    url: '/schExamineLightType/listLightType'
  });
/**
 * 根据ID删除亮灯规则
 * @param {id :  123}
 */
export const removeLightType = data =>
  request({
    method: 'delete',
    url: '/schExamineLightType/remove/' + data
  });

/**
 * 查询宿舍时间组 ----------------------------------
 */
export const getTimeGroupList = data =>
  request({
    method: 'get',
    url: '/schDormitoryAccessSetting/getTimeGroupList',
    params: data
  });

/**
 * 保存时间组(添加和修改) ----------------------------------
 */
export const saveTimeGroup = data =>
  request({
    method: 'post',
    url: '/schDormitoryAccessSetting/saveTimeGroup',
    data
  });
/**
 * 修改权限
 ----------------------------------
 */
export const updatePermission = data =>
  request({
    method: 'post',
    url: '/schPermissionSetting/updatePermission',
    data
  });
/**
 * 查询权限 ----------------------------------
 */
export const getTimePermission = data =>
  request({
    method: 'get',
    url: '/schPermissionSetting/getTimePermission',
    params: data
  });
/**
 * 开关管理人员门禁组 ----------------------------------
 */
export const allowAdminAccess = data =>
  request({
    method: 'post',
    url: '/schDormitoryAccessSetting/allowAdminAccess',
    data: data
  });
